package mapkit
{
	import flash.events.EventDispatcher;

	public class MapHandler extends EventDispatcher
	{
		private var _map:Map=null;

		final protected function get map():Map
		{
			return _map;
		}

		virtual public function get keyboardLocked():Boolean
		{
			return false;
		}

		virtual public function get mouseLocked():Boolean
		{
			return false;
		}

		private var _ready:Boolean=false;

		final public function get ready():Boolean
		{
			return _ready;
		}

		final public function start(map_:Map):void
		{
			if (ready)
			{
				return;
			}
			_map=map_;
			load();
			_ready=true;
		}

		final public function stop():void
		{
			if (!ready)
			{
				return;
			}
			unload();
			_map=null;
			_ready=false;
		}

		virtual protected function load():void
		{
			//
		}

		virtual protected function unload():void
		{
			//
		}

	}

}

